﻿namespace Agent
{
    using System;
    using System.Runtime.CompilerServices;
    using System.Security.Cryptography;
    using System.Text;
    using System.Threading;

    public class AgentUser
    {
        private EventHandler a;
        protected string b;
        private LicenseType c;
        [CompilerGenerated]
        private string d;
        [CompilerGenerated]
        private static AgentUser e;

        public void a(EventHandler A_0)
        {
            EventHandler handler2;
            EventHandler a = this.a;
            do
            {
                handler2 = a;
                EventHandler handler3 = (EventHandler) Delegate.Combine(handler2, A_0);
                a = Interlocked.CompareExchange<EventHandler>(ref this.a, handler3, handler2);
            }
            while (a != handler2);
        }

        public void b(EventHandler A_0)
        {
            EventHandler handler2;
            EventHandler a = this.a;
            do
            {
                handler2 = a;
                EventHandler handler3 = (EventHandler) Delegate.Remove(handler2, A_0);
                a = Interlocked.CompareExchange<EventHandler>(ref this.a, handler3, handler2);
            }
            while (a != handler2);
        }

        public static AgentUser CurrentUser
        {
            [CompilerGenerated]
            get
            {
                return e;
            }
            [CompilerGenerated]
            set
            {
                e = value;
            }
        }

        public LicenseType License
        {
            get
            {
                return this.c;
            }
            set
            {
                if (value != this.c)
                {
                    this.c = value;
                    if (this.a != null)
                    {
                        this.a(null, null);
                    }
                }
            }
        }

        public string Login
        {
            [CompilerGenerated]
            get
            {
                return this.d;
            }
            [CompilerGenerated]
            set
            {
                this.d = value;
            }
        }

        public string Password
        {
            get
            {
                return this.b;
            }
            set
            {
                this.b = value;
            }
        }

        public string PasswordHash
        {
            get
            {
                string str = string.Empty;
                using (MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider())
                {
                    foreach (byte num in provider.ComputeHash(Encoding.Default.GetBytes(this.b)))
                    {
                        str = str + num.ToString("X2");
                    }
                }
                return str;
            }
        }
    }
}

